/*
 * 融资申请
 *
 */
import { postRequest, getRequest, postDownload } from '/@/lib/axios';

export const rzApplyApi = {
  // 分页
  page: (param) => {
    return postRequest('/buss/listBussInfo', param);
  },
  // 订单详情
  getOrderInfo: (param) => {
    return postRequest('/orders/getOrderInfo', param);
  },
  // 生成订单号
  create: (param) => {
    return postRequest('/buss/genBussNo', param);
  },
  // 订单承租人列表
  lesseePartInfoList: (param) => {
    return postRequest('/lessee/lesseePartInfoList', param);
  },
  // 承租人---保存或更新
  lesseeAddOrUpdate: (param) => {
    return postRequest('/lessee/lesseeAddOrUpdate', param);
  },
  // 承租人---保存前校验，有错误信息调用暂存，校验通过调用保存
  lesseeVerify: (param) => {
    return postRequest('/lessee/lesseeVerify', param);
  },
  // 承租人---删除
  lesseeDelete: (param) => {
    return getRequest(`/lessee/delete/${param.id}`);
  },

  // 承租人---暂存
  lesseeTempSave: (param) => {
    return postRequest('/lessee/tempSave', param);
  },

  // 保证人--订单-列表
  guarantorList: (param) => {
    return postRequest('/guarantor/guarantorList', param);
  },
  // 保证人----保存或更新
  guarantorAddOrUpdate: (param) => {
    return postRequest('/guarantor/guarantorAddOrUpdate', param);
  },

  // 保证人---保存前校验，有错误信息调用暂存，校验通过调用保存
  guarantorVerify: (param) => {
    return postRequest('/guarantor/guarantorVerify', param);
  },
  // 保证人----删除
  guarantorDelete: (param) => {
    return getRequest(`/guarantor/delete/${param.id}`);
  },

  // 保证人----暂存
  guarantorTempSave: (param) => {
    return postRequest('/guarantor/tempSave', param);
  },

  // 租赁物树，产商-品牌-型号
  getManufacturer: (param) => {
    return postRequest('/leaseHold/getManufacturer', param);
  },
  // 租赁物树，产商-品牌-型号 保存或更新
  leaseHoldSaveOrUpdate: (param) => {
    return postRequest('/leaseHold/saveOrUpdate', param);
  },
  // 租赁物树，产商-品牌-型号 租赁物信息列表
  leaseHoldGetLeaseList: (param) => {
    return postRequest('/leaseHold/getLeaseList', param);
  },
  // 租赁物树，删除
  leaseHoldDelete: (param) => {
    return getRequest(`/leaseHold/delete/${param.id}`);
  },
  // 报价方案品牌
  brandList: (param) => {
    return postRequest('/contractClause/brandList', param);
  },
  // 报价方案列表
  configList: (param) => {
    return postRequest('/contractClause/configList', param);
  },
  // 影响资料--分页查询
  getStructure: (param) => {
    return postRequest('/auditFile/getStructure', param);
  },
  // 字段查询
  dictByKeyCode: (keyCode) => {
    return getRequest(`/support/dict/value/list/${keyCode}`);
  },
  // 获取设备总价
  dictByKeyCode: (bussNo) => {
    return getRequest(`/contractClause/getSumPurchasePrice/${bussNo}`);
  },
  // 计算 -- 租金计算
  calcTrial: (param) => {
    return postRequest(`/contractClause/calcTrial`, param);
  },

  // 保存或更新 -- 租金计算
  calcTrialSaveOrUpdate: (param) => {
    return postRequest(`/contractClause/saveOrUpdate`, param);
  },
  // 当前订单报价方案详情 -- 租金计算
  calcTrialInfo: (param) => {
    return postRequest(`/contractClause/info`, param);
  },
  // 订单提交
  submit: (param) => {
    return postRequest(`/orders/submit`, param);
  },
  // ocr单次识别
  ocrUpload: (param) => {
    // const formDataObject = {};
    // param.forEach((value, key) => {
    //   formDataObject[key] = value;
    // });
    // const formDataString = Object.keys(formDataObject)
    //   .map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(formDataObject[key]))
    //   .join('&');
    return postRequest(`/ocr/filesUpload`, param);
  },

  
};
